/**
 * 
 */
define(["jquery", "knockout","durandal/composition",'BMap','panel',
         "http", "i18nCommon","kovholder",'WdatePicker','video','css!style/common/common-style'],
		function($, ko, composition, baiduMap, panal, http, i18nCommon,kov,WdatePicker,videojs){

	function model(){
    	var self = this;
    	var IP = "134.200.0.240";
		var port = "80";
		var UserName = "admin";
		var Password = "Abc123++";
		var VAGIP = "134.200.0.240";
		var VAGPort = "7302";
		var Code = "001063";

		composition.addBindingHandler("videoplay-init",{
			init: function(dom){
				p = panal.getPanalByElement(dom);
				_dom = dom;
				initUI();
				initData();
				LoginPlat()				
		}});
		
		function initUI() {

		}
		
		function LoginPlat()
		{

			//默认使用密码登录方式
			var v1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><LoginInfo><LoginType>2</LoginType><SynLogin>1</SynLogin><IP>"+IP+"</IP><Port>"+port
			+"</Port><UserName>"+UserName+"</UserName><Password>"+Password+"</Password></LoginInfo>";
			var v = videoPlay.LoginPlat(v1);
			if(v !== 0){
				alert("登录失败，请查看日志preview.log");
			}else{
				StartPreview();
			}						
		}
		
		//新的预览接口，需先登录平台，登录需要耗点时间，稍等（控件自身取Token）
		function StartPreview()
		{			
			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview><CamIndexCode>"+Code+"</CamIndexCode></Preview>";
			
			videoPlay.StartPreview( _param);
		}
		
		function initData() {
			
		}
	}
	
    return model;
});